{% extends 'AdminBundle::layout.html.twig' %}

{% block title %}编辑个人信息{% endblock %}

{% block css %}
    <style>
        .pop-com-input{
            line-height: 22px;
        }
    </style>
{% endblock %}

{% block top %}
    {#{{ dump() }}#}
    {{ parent() }}
{% endblock %}



    {% block left_body_top %}
        {{ parent() }}
    {% endblock %}

    {% block left_body %}
        {{ parent() }}
    {% endblock %}

    {% block right_body %}
    <div class="page-header">
        <div class="page-right-top">
            <div class="right-top">
                <span class="right-title">系统设置</span>
            </div>
            <div class="top-nav">个人信息</div>
            <span class="r-arrow top-r-arrow"></span>
            <div class="top-nav top-nav-active">编辑修改</div>
        </div>
        <div class="main-content">
            <div class="mes-content">
                <form id="comMesBtn">
                    <div class="com-list">
                        <div class="com-list-box">
                            <div class="com-left fl">管理员姓名</div>
                            <div class="pop-com-input">{{ data.data.realname }}</div>
                        </div>

                        <div class="com-list-box">
                            <div class="com-left fl">手机号码</div>
                            <div class="pop-com-input">{{ data.data.phone }}</div>
                        </div>

                        <div class="com-list-box">
                            <div class="com-left fl">邮箱</div>
                            <input type="text" name="email" value="{{ data.data.email }}" class="pop-com-input admin-email" style="width: 560px;" placeholder="请输入邮箱">
                        </div>
                        {% if data.data.admin_role_id != 2 %}

                        <div class="display">
                            <div class="com-list-box fl">
                                <div class="com-left fl">身份属性</div>
                                <div class="select-jurisdiction fl">
                                    <span class="radio-icon {% if data.data.admin_role_id == 3 %}radio-icon-check{% endif %} fl" data-value="3"></span>
                                    <span class="file-text fl">普通管理员</span>
                                </div>

                                <div class="select-jurisdiction fl">
                                    <span class="radio-icon fl {% if data.data.admin_role_id == 4 %}radio-icon-check{% endif %}" data-value="4"></span>
                                    <span class="file-text fl">科技载体管理员</span>
                                </div>
                            </div>
                            <div class="clearfix"></div>
                        </div>
                        {% endif %}

                        <div class="com-list-box">
                            <div class="com-left fl">管理员名称</div>
                            <input type="text" name="nickname" value="{{ data.data.nickname }}" class="pop-com-input admin-name" style="width: 560px;" placeholder="请输入管理员名称">
                        </div>

                        <div class="com-list-box">
                            <div class="com-left fl">所属区域</div>
                            <div class="pop-com-input">{{ data.data.district_name }}</div>
                        </div>


                        <div class="clearfix"></div>
                        <div class="add-mem-box" style="margin-top: 40px;">
                            <div class="com-left fl"></div>
                            <div class="acc-opera-btn fl mem-btn p-first-btn">保存</div>
                            <a class="acc-opera-btn fl mem-cancel" href="{{ path('setting_index') }}">取消</a>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>

    {% endblock %}


{% block box %}
{% endblock %}


{% block javascript %}
<script type="text/javascript">
    $(function () {

        SidebarHighlighting('8');

        SonSidebar('8', '1');

        $('.p-first-btn').on('click', function() {
            var param = $('#comMesBtn').serializeObject();
            console.log(param);

            if(param.email == ""){
                popStatus(2,"请输入邮箱",1,"",true);
                return;
            }

            if(param.nickname == ""){
                popStatus(2,"请输入管理员名称",1,"",true);
                return;
            }

            $.post("{{ path('api_admin_auth_edit_self_information') }}",param,function (data) {
                console.log(data);
                if(data.errorCode == 0){
                    popStatus(1, data.message, 1, "{{ path('setting_index') }}", true);
                } else {
                    popStatus(2, data.message, 1, "", true);
                }
            })
        })
    })
</script>
{% endblock %}